package org.agentsherpa.ui;

import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import javax.imageio.ImageIO;

import org.agentsherpa.model.Ied;

public class Icons {
    private final BufferedImage drone;
    private final BufferedImage iedActive;
    private final BufferedImage iedDisarmed;
    private final BufferedImage iedExploded;
    private final Map<Ied.Status,BufferedImage> ieds = new HashMap<Ied.Status,BufferedImage>();
    
    private Icons() {
        try {
            drone = ImageIO.read(Icons.class.getResource("image/penguin.png"));
            iedActive = ImageIO.read(Icons.class.getResource("image/clanbomber.png"));
            iedDisarmed = ImageIO.read(Icons.class.getResource("image/error.png"));
            iedExploded = ImageIO.read(Icons.class.getResource("image/cache.png"));
        }
        catch (IOException e) {
            e.printStackTrace();
            throw new AssertionError(e);
        }
        
        ieds.put(Ied.Status.Active, iedActive);
        ieds.put(Ied.Status.Disamred, iedDisarmed);
        ieds.put(Ied.Status.Exploded, iedExploded);
    }
    
    private final static Icons theInstance = new Icons();
    
    public static Icons instance() {
        return theInstance;
    }
    
    public BufferedImage drone() {
        return drone;
    }
    
    public BufferedImage iedActive() {
        return iedActive;
    }

    public BufferedImage iedDisarmed() {
        return iedDisarmed;
    }

    public BufferedImage iedExploded() {
        return iedExploded;
    }

    public BufferedImage iedByStatus(Ied.Status status) {
        return ieds.get(status);
    }

}
